package org.pet;
import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        int l = in.nextInt();
        int [] a = new int[l];
        a[0] = in.nextInt();
        int num = 1;
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int x = in.nextInt();
            int i = num;
            int index = getIndex(a,x,i);
            if(index == -1) continue;
            else{
                for(int j = index; j < i;i--){
                    a[i] = a[i-1];
                    if(i-1 == index)
                    a[i-1] = x;
                    else continue;
                }
            }
            num++;
            if(num>l) break;
        }
        for(int j = 0; j < a.length; j++){
            if (a[j] == 0) {
                break;
            }
            System.out.println(a[j]);
        }

    }
    public static int getIndex(int[] a,int x,int i){
        for(int j = 0; j < i; j++){
            if(a[j] == x) return -1;
            if(a[j] < x) break;
            if(a[j] > x) return j;
        }
        return -1;
    }
}
